package com.xxchat.config;

import com.xxchat.utils.StringTools;
import lombok.Getter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

/**
 * @author Waicc
 */
@Configuration("appConfig")
public class AppConfig {
    // ws端口
    @Getter
    @Value("${ws.port}")
    private Integer wsPort;

    @Getter
    @Value("${spring.redis.host}")
    private String redisHost;

    @Getter
    @Value("${spring.redis.port}")
    private String redisPort;

    // 文件目录
    @Value("${project.folder}")
    private String projectFolder;

    // 管理员邮箱
    @Getter
    @Value("${admin.email}")
    private String adminEmail;

    public String getProjectFolder() {
        if (StringTools.isEmpty(projectFolder) && !projectFolder.endsWith("/")) {
            projectFolder = projectFolder + "/";
        }
        return projectFolder;
    }
}
